<?php
// +----------------------------------------------------------------------
// | IndexAction.class.php - MyPT
// +----------------------------------------------------------------------
// | Copyleft (c) 2010 By Asxzy All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Asxzy <asxzy@163.com>
// +----------------------------------------------------------------------
class IndexAction extends CommonAction{	
    public function index(){
    	$torrents = M('torrents');
    	import("ORG.Util.Page");
    	$count = $torrents->where("status='confirmed'")->count();
    	$Page = new Page($count,20);
    	$show = $Page->show();
    	$data = $torrents->where("status='confirmed'")->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select(); 
    	$data = formatTorrents($data);
    	$this->assign('page',$show);
    	$this->assign('latestitem',$data);
    	if (empty($_GET['p']) or ($_GET['p']<=1)){
    		
    	}
    	$this->display();    	
    }

}
?>